package ar.com.gestion.componentes;

import java.util.LinkedList;
import java.util.List;

import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;

import ar.com.gestion.dominio.Cliente;

public class CustomComboModel implements ComboBoxModel<Cliente>{

	
	
	private List<Cliente> listaClientes = new LinkedList<Cliente>();
	private LinkedList<ListDataListener> listeners = new LinkedList<ListDataListener>();
	private Cliente selectedItem = new Cliente();
	
	@Override
	public int getSize() {
		return listaClientes.size();
	}

	@Override
	public Cliente getElementAt(int index) {
		return listaClientes.get(index);
	}

	@Override
	public void addListDataListener(ListDataListener l) {
		
		listeners.add(l);
		
	}


	
	@Override
	public void removeListDataListener(ListDataListener l) {
		listeners.remove(l);
	}

	@Override
	public void setSelectedItem(Object anItem) {
		selectedItem =(Cliente) anItem;
		
		
	}

	@Override
	public Object getSelectedItem() {
		
		return selectedItem;
	}
	public void setListaClientes(List<Cliente> listaClientes){
		
		this.listaClientes = listaClientes;
	}
	

}
